/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejemplojavaex;

import java.awt.TextField;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.layout.AnchorPane;
import mx.edu.itschapala.sistemas.septimo.control.VentaLnLista;
import mx.edu.itschapala.sistemas.septimo.control.VentaLnLocal;
import mx.edu.itschapala.sistemas.septimo.modelo.Venta;

/**
 * FXML Controller class
 *
 * @author Miguel Romero
 */
public class RegistrarVentaController implements Initializable {

    @FXML
    private AnchorPane ventanaRV;
    @FXML
    private TextField idV;
    @FXML
    private TextField idC;
    @FXML
    private TextField nombreC;
    @FXML
    private TextField idP;
    @FXML
    private TextField nombreP;
    @FXML
    private TextField fecha;
    
    @FXML
    public void ventanaListarVentas(){
        try{
            Parent root = FXMLLoader.load(getClass().getResource("ListarVentas.fxml"));
            ventanaRV.getScene().setRoot(root);
        }catch (IOException e){
            System.out.println("Error al cargar la ventana de menu");
        }
        
    }
    @FXML
    public void RegistrarVenta(){
       
        Venta v = new Venta(
//                Integer.parseInt(codigo.getText()), 
//                nombre.getText(),
//                Float.parseFloat(precio.getText()),
//                departamento.getText(),
//                descripcion.getText()
                );
        
        VentaLnLocal pln = VentaLnLista.getIsnstnciaV();
        pln.ventaregistrar(v);
        
    }
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }    
    
}
